package com.example.shop_2210.cateDetail

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.base.entity.GoodsEntityResult
import com.example.base.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class CategoryDetailViewModel:BaseViewModel() {
    val success = MutableLiveData<GoodsEntityResult>()
    val fail = MutableLiveData<String>()
    fun search(cid:Int,keyword:String,page:Int,limit:Int){
        viewModelScope.launch {
            try {
                success.value = apiService.search(cid,keyword,limit,true,page,"","")
            }catch (e:Exception){
                fail.value = e.message
            }
        }
    }
}